public class ATransportBluetooth extends ATransport
ATransport.IBufferControlEventListener, ATransport.IConnectStateEventListenerDUMP, INFO, IO, mAddress, mConnType, mDevName, mDevType, mIsAutoConnect, mIsDeviceAttached, mMacAddress, mQueue, mState, TAG| Constructor and Description |
|---|
ATransportBluetooth()
Create an instance of the ATransportBluetooth class
|
ATransportBluetooth(DeviceType type,
java.lang.String name,
java.lang.String address)
Create an instance of the ATransportBluetooth class
|
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Returns the length of data that can be read with the read method.
|
boolean |
connect()
Attempts to connect to the appliance using an instance of the Transport class.
|
void |
destroy()
ATransportBluetooth Destroys the instance and returns the resource.
|
void |
disconnect()
An instance of the Transport class closes the connection to the device to which the device is connected.
|
boolean |
getAutoConnect()
Returns whether automatically connect to the appliance using an instance of the Transport class.
|
boolean |
getDeviceAttached()
Returns whether attached to the appliance using an instance of the Transport class.
|
void |
listen()
An instance of the ATransport class waits for the device to connect.
|
int |
read(byte[] data,
int offset,
int length)
Read data received from the device.
|
int |
read(byte[] data,
int offset,
int length,
int timeout)
Read data received from the device.
|
void |
setAutoConnect(boolean enabled)
Sets whether automatically connect to the appliance using an instance of the Transport class.
|
int |
write(byte[] data,
int offset,
int length)
Transfer data to the device.
|
int |
write(byte[] data,
int offset,
int length,
int timeout)
Transfer data to the device.
|
checkBufferSize, getAddress, getConnectType, getDeviceName, getDeviceType, getMacAddress, getState, read, read, setAddress, setBufferControlListener, setBufferControlListener, setDeviceName, setDeviceType, setMacAddress, setState, setStateListener, toString, write, writepublic ATransportBluetooth()
public ATransportBluetooth(DeviceType type, java.lang.String name, java.lang.String address)
type - A DeviceType enumeration that specifies the type of connected device using an instance of the ATransportBluetooth class.name - A string that specifies the name of the connected device using an instance of the ATransportBluetooth class.address - A string that specifies the address of the connected device by using an instance of the ATransportBluetooth class.public void destroy()
destroy in class ATransportpublic void setAutoConnect(boolean enabled)
ATransportsetAutoConnect in class ATransportenabled - A boolean specifying whether the device automatically connect.public boolean getAutoConnect()
ATransportgetAutoConnect in class ATransportpublic boolean getDeviceAttached()
ATransportgetDeviceAttached in class ATransportpublic boolean connect()
ATransportconnect in class ATransportpublic void listen()
ATransportlisten in class ATransportpublic void disconnect()
ATransportdisconnect in class ATransportpublic int write(byte[] data,
int offset,
int length)
ATransportwrite in class ATransportdata - A byte array that specifies the data to transfer to the Device.offset - An integer indicating the start address of the data to be transferred to the Device.length - An integer indicating the length of the data to be transferred to the Device.public int write(byte[] data,
int offset,
int length,
int timeout)
ATransportwrite in class ATransportdata - A byte array that specifies the data to transfer to the Device.offset - An integer indicating the start address of the data to be transferred to the Device.length - An integer indicating the length of the data to be transferred to the Device.timeout - An integer specifying the timeout of data transmission to the device.public int available()
ATransportavailable in class ATransportpublic int read(byte[] data,
int offset,
int length)
ATransportread in class ATransportdata - A byte array to store the data received from the device.offset - Integer specifying the start address at which data received from device will begin to be stored in a byte array.length - An integer specifying the maximum length at which data received from the device can be stored in a byte array.public int read(byte[] data,
int offset,
int length,
int timeout)
ATransportread in class ATransportdata - A byte array to store the data received from the device.offset - Integer specifying the start address at which data received from device will begin to be stored in a byte array.length - An integer specifying the maximum length at which data received from the device can be stored in a byte array.timeout - An integer that specifies the timeout for reading data received from the device.